package com.huawei.hianalytics.h;

import com.huawei.hianalytics.g.b;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

public class d {
    private String a;
    private List<g> b = new LinkedList();

    d(String str) {
        this.a = str;
    }

    public c a(byte[] bArr, Map<String, String> map) {
        int size = this.b.size();
        for (int i = 0; i < size; i++) {
            g gVar = (g) this.b.get(i);
            if (gVar.c()) {
                c a = b.a(gVar.a, bArr, (Map) map);
                b.b("ReportInstance", "response code : " + a.a());
                if (-104 != a.a()) {
                    gVar.a();
                    return a;
                }
                gVar.b();
            } else {
                b.b("ReportInstance " + this.a, "No." + i + " address failed more than 5 times. Try with backup address...");
            }
        }
        b.b("ReportInstance " + this.a, "All backup address not valid.");
        return new c(-107, "");
    }

    public void a(String[] strArr) {
        for (String gVar : strArr) {
            this.b.add(new g(gVar));
        }
    }
}
